/*
 *	This file is part of Lounge-Cast.
 *
 *  Author:  	Markus Moormann
 *	E-mail:  	mmoorman@uni-osnabrueck.de
 *	Copyright:	University of Osnabrueck (Zentrum Virtuos)
 * 	Website:	www.uni-osnabrueck.de
 *	Date:		16.02.2011
 *
 *	Lounge-Cast is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *	Lounge-Cast is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Lounge-Cast.  If not, see <http://www.gnu.org/licenses/>.
 */
package multimedia.model.vo
{
	import mx.collections.ArrayCollection;
	
	/**
	 * class representing a user
	 */
	[Bindable]
	[RemoteClass(alias="backend.vo.UserVO")]
	public class UserVO
	{
		/**
		 * internal id of the user
		 */
		public var user_id:int;
		/**
		 * the user name of the user
		 */
		public var user_name:String;
		/**
		 * the e-mail adress of the user
		 */
		public var user_email:String;
		/**
		 * whether to login via LDAP or not
		 */
		public var is_ldap:Boolean = true;
		/**
		 * the playlists the user can edit
		 */
		public var playlists:ArrayCollection;
		/**
		 * the password of the user
		 */
		public var user_password:String
		/**
		 * the group the user belongs to
		 */
		public var user_group:GroupVO = new GroupVO();
		
		/**
		 * default constructor
		 */
		public function UserVO()
		{
			playlists = new ArrayCollection();
		}
		
		public function hasPlaylist(playlist:PlaylistVO):Boolean
		{
			for each(var play:PlaylistVO in playlists)
			{
				if(playlist.playlist_id == play.playlist_id)
				{
					return true;
				}
			}
			return false;
		}
	}
}